<form class="form-horizontal" id="form-edit">
    <input type="hidden" name="uri" value="<%= typeof(data.cpFunc)!=='undefined'?data.cpFunc:'' %>" />
    <div class="form-group">
        <label class="control-label col-sm-4">Nhóm:</label>
        <div class="col-sm-8">
            <select class="form-control" name="groupId">
                <option value="">--Chọn nhóm--</option>
                <% $.each(cpFunctionGroups, function(){ %>
                <option <%= (typeof(data.groupId)!=='undefined' && data.groupId == this.id)?'selected':'' %> value="<%= this.id %>"><%= this.name %></option>
                <% }); %>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-4">Hoặc tạo nhóm:</label>
        <div class="col-sm-8">
            <div class="col-sm-6">
                <input name="groupName" type="text" class="form-control" placeholder="Tên nhóm" />
            </div>
            <div class="col-sm-6">
                <input name="groupPosition" type="text" class="form-control" placeholder="Thứ tự nhóm" />
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-4">Tên chức năng:</label>
        <div class="col-sm-8">
            <input name="name" value="<%= typeof(data.name)!=='undefined'?data.name:'' %>" type="text" class="form-control" placeholder="Tên chức năng"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-4">Thứ tự:</label>
        <div class="col-sm-8">
            <input name="position" value="<%= typeof(data.position)!=='undefined'?data.position:'' %>" type="number" class="form-control" placeholder="Thứ tự"/>
        </div>
    </div>
    <% if(data.action.length > 0){ %>
    <table class="table">
        <tr>
            <th>Định nghĩa hành động</th>
            <th style="width: 90px">Sắp xếp</th>
            <th style="width: 90px">Bỏ quyền</th>
        </tr>
        <% $.each(data.action, function(){  %>
        <tr for="service" >
            <td>
                <input type="hidden" for="uri" value="<%= this %>"/>
                <input for="name"  value="" type="text" class="form-control input-sm" placeholder="Tên hành động"/>
                <span class="help-block"><%= this %></span>
            </td>
            <td>
                <input for="position" value="0" class="form-control input-sm"/>
            </td>
            <td style="text-align: center"><input for="skip" type="checkbox" /></td>
        </tr>
        <% }); %>
    </table>
    <% } %>
</div>
</form>